
const mysql = require('mysql');
const dbconfig = require('../config/dbconfig.js')
const connection = mysql.createConnection(dbconfig);

//连接mysql
connection.connect(function (err) {
    if (err) {
        console.error('连接失败');
        return;
    }
    console.log('连接mysql成功');
});

function dbQuery(sql,callback){
    connection.query(sql,callback);
}


module.exports = dbQuery;